Rules for integrands of the form (((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)

1.  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0

1:  ∫((((g Tan[e+f x]))^p)/(a+b Sin[e+f x]))dx  when (a^2)-(b^2)==0

Derivation: Algebraic expansion

Basis: If  (a^2)-(b^2)==0, then (1/(a+b Sin[z]))==(((Sec[z])^2)/a)-((Sec[z] Tan[z])/b)

Note: If  p==-1, it is better to use the following substitution rule, since it results in a more continuous antiderivative.

Rule: If  (a^2)-(b^2)==0, then

∫((((g Tan[e+f x]))^p)/(a+b Sin[e+f x]))dx  ⟶  (1/a) ∫((Sec[e+f x])^2) (((g Tan[e+f x]))^p) dx-(1/(b g)) ∫Sec[e+f x] (((g Tan[e+f x]))^(p+1)) dx

Program code:

Int[(g_.*tan[e_.+f_.*x_])^p_./(a_+b_.*sin[e_.+f_.*x_]),x_Symbol] :=
  1/a*Int[Sec[e+f*x]^2*(g*Tan[e+f*x])^p,x] - 1/(b*g)*Int[Sec[e+f*x]*(g*Tan[e+f*x])^(p+1),x] /;
FreeQ[{a,b,e,f,g,p},x] && EqQ[a^2-b^2,0] && NeQ[p,-1]

2:  ∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ ((p+1)/2)∈ℤ

Derivation: Integration by substitution

Basis: If ((p+1)/2)∈ℤ ∧ (a^2)-(b^2)==0, then ((Tan[e+f x])^p)==((b Cos[e+f x] (((b Sin[e+f x]))^p))/((((a-b Sin[e+f x]))^((p+1)/2)) (((a+b Sin[e+f x]))^((p+1)/2))))

Basis: Cos[e+f x] F[b Sin[e+f x]]==(1/(b f)) Subst[F[x],x,b Sin[e+f x]] (∂_x)(b Sin[e+f x])

Rule: If (a^2)-(b^2)==0 ∧ ((p+1)/2)∈ℤ, then

∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  ⟶  b ∫((Cos[e+f x] (((b Sin[e+f x]))^p) (((a+b Sin[e+f x]))^(m-((p+1)/2))))/(((a-b Sin[e+f x]))^((p+1)/2)))dx
  ⟶  (1/f) Subst[∫(((x^p) (((a+x))^(m-((p+1)/2))))/(((a-x))^((p+1)/2)))dx,x,b Sin[e+f x]]

Program code:

Int[tan[e_.+f_.*x_]^p_.*(a_+b_.*sin[e_.+f_.*x_])^m_.,x_Symbol] :=
  1/f*Subst[Int[x^p*(a+x)^(m-(p+1)/2)/(a-x)^((p+1)/2),x],x,b*Sin[e+f*x]] /;
FreeQ[{a,b,e,f,m},x] && EqQ[a^2-b^2,0] && IntegerQ[(p+1)/2]

3.  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ m∈ℤ

1:  ∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ m∈ℤ ∧ p==2 m

Derivation: Algebraic simplification

Basis: If  (a^2)-(b^2)==0 ∧ m∈ℤ ∧ p==2 m, then ((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)==(((a^p) ((Sin[e+f x])^p))/(((a-b Sin[e+f x]))^m))

Rule: If  (a^2)-(b^2)==0 ∧ m∈ℤ ∧ p==2 m, then

∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  ⟶  (a^p) ∫(((Sin[e+f x])^p)/(((a-b Sin[e+f x]))^m))dx

Program code:

Int[tan[e_.+f_.*x_]^p_*(a_+b_.*sin[e_.+f_.*x_])^m_.,x_Symbol] :=
  a^p*Int[Sin[e+f*x]^p/(a-b*Sin[e+f*x])^m,x] /;
FreeQ[{a,b,e,f},x] && EqQ[a^2-b^2,0] && IntegersQ[m,p] && EqQ[p,2*m]

2:  ∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ (m|(p/2))∈ℤ ∧ (p<0 ∨ m-(p/2)>0)

Derivation: Algebraic expansion

Basis: If  (a^2)-(b^2)==0 ∧ (p/2)∈ℤ, then ((Tan[e+f x])^p)==(((a^p) ((Sin[e+f x])^p))/((((a+b Sin[e+f x]))^(p/2)) (((a-b Sin[e+f x]))^(p/2))))

Rule: If  (a^2)-(b^2)==0 ∧ (m|(p/2))∈ℤ ∧ (p<0 ∨ m-(p/2)>0), then

∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  ⟶  (a^p) ∫ ExpandIntegrand[((((Sin[e+f x])^p) (((a+b Sin[e+f x]))^(m-(p/2))))/(((a-b Sin[e+f x]))^(p/2))),x]dx

Program code:

Int[tan[e_.+f_.*x_]^p_*(a_+b_.*sin[e_.+f_.*x_])^m_,x_Symbol] :=
  a^p*Int[ExpandIntegrand[Sin[e+f*x]^p*(a+b*Sin[e+f*x])^(m-p/2)/(a-b*Sin[e+f*x])^(p/2),x],x] /;
FreeQ[{a,b,e,f},x] && EqQ[a^2-b^2,0] && IntegersQ[m,p/2] && (LtQ[p,0] || GtQ[m-p/2,0])

3:  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ m∈(SuperPlus[ℤ])

Derivation: Algebraic expansion

Rule: If  (a^2)-(b^2)==0 ∧ m∈(SuperPlus[ℤ]), then

∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  ⟶  ∫(((g Tan[e+f x]))^p) ExpandIntegrand[(((a+b Sin[e+f x]))^m),x]dx

Program code:

Int[(g_.*tan[e_.+f_.*x_])^p_.*(a_+b_.*sin[e_.+f_.*x_])^m_.,x_Symbol] :=
  Int[ExpandIntegrand[(g*Tan[e+f*x])^p,(a+b*Sin[e+f*x])^m,x],x] /;
FreeQ[{a,b,e,f,g,p},x] && EqQ[a^2-b^2,0] && IGtQ[m,0]

4:  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ m∈(SuperMinus[ℤ])

Derivation: Algebraic expansion

Basis: If  (a^2)-(b^2)==0 ∧ m∈ℤ, then (((a+b Sin[e+f x]))^m)==(a^(2 m)) ((Sec[e+f x])^(-m)) (((a Sec[e+f x]-b Tan[e+f x]))^(-m))

Rule: If  (a^2)-(b^2)==0 ∧ m∈(SuperMinus[ℤ]), then

∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  ⟶  (a^(2 m)) ∫(((g Tan[e+f x]))^p) ((Sec[e+f x])^(-m)) ExpandIntegrand[(((a Sec[e+f x]-b Tan[e+f x]))^(-m)),x] dx

Program code:

Int[(g_.*tan[e_.+f_.*x_])^p_.*(a_+b_.*sin[e_.+f_.*x_])^m_,x_Symbol] :=
  a^(2*m)*Int[ExpandIntegrand[(g*Tan[e+f*x])^p*Sec[e+f*x]^(-m),(a*Sec[e+f*x]-b*Tan[e+f*x])^(-m),x],x] /;
FreeQ[{a,b,e,f,g,p},x] && EqQ[a^2-b^2,0] && ILtQ[m,0]

4.  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ m∉ℤ

1.  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ m∉ℤ ∧ (p/2)∈ℤ

1.  ∫((Tan[e+f x])^2) (((a+b Sin[e+f x]))^m)dx  when  (a^2)-(b^2)==0 ∧ m∉ℤ

1:  ∫((Tan[e+f x])^2) (((a+b Sin[e+f x]))^m)dx  when  (a^2)-(b^2)==0 ∧ m∉ℤ ∧ m<0

Derivation: ???

Rule: If  (a^2)-(b^2)==0 ∧ m∉ℤ ∧ m<0, then

∫((Tan[e+f x])^2) (((a+b Sin[e+f x]))^m)dx  ⟶  
((b (((a+b Sin[e+f x]))^m))/(a f (2 m-1) Cos[e+f x]))-(1/((a^2)(2 m-1)))∫(((((a+b Sin[e+f x]))^(m+1)) (a m-b (2 m-1) Sin[e+f x]))/((Cos[e+f x])^2))dx

Program code:

Int[tan[e_.+f_.*x_]^2*(a_+b_.*sin[e_.+f_.*x_])^m_,x_Symbol] :=
  b*(a+b*Sin[e+f*x])^m/(a*f*(2*m-1)*Cos[e+f*x]) - 
  1/(a^2*(2*m-1))*Int[(a+b*Sin[e+f*x])^(m+1)*(a*m-b*(2*m-1)*Sin[e+f*x])/Cos[e+f*x]^2,x] /;
FreeQ[{a,b,e,f},x] && EqQ[a^2-b^2,0] && Not[IntegerQ[m]] && LtQ[m,0]

2:  ∫((Tan[e+f x])^2) (((a+b Sin[e+f x]))^m)dx  when  (a^2)-(b^2)==0 ∧ m∉ℤ ∧ m≮0

Derivation: Nondegenerate sine recurrence 1b with A->(a^2),B->2 a b,C->(b^2),m->0

Rule: If  (a^2)-(b^2)==0 ∧ m∉ℤ ∧ m≮0, then

∫((Tan[e+f x])^2) (((a+b Sin[e+f x]))^m)dx  ⟶  
-((((a+b Sin[e+f x]))^(m+1))/(b f m Cos[e+f x]))+(1/(b m))∫(((((a+b Sin[e+f x]))^m) (b (m+1)+a Sin[e+f x]))/((Cos[e+f x])^2))dx

Program code:

Int[tan[e_.+f_.*x_]^2*(a_+b_.*sin[e_.+f_.*x_])^m_,x_Symbol] :=
  -(a+b*Sin[e+f*x])^(m+1)/(b*f*m*Cos[e+f*x]) + 
  1/(b*m)*Int[(a+b*Sin[e+f*x])^m*(b*(m+1)+a*Sin[e+f*x])/Cos[e+f*x]^2,x] /;
FreeQ[{a,b,e,f,m},x] && EqQ[a^2-b^2,0] && Not[IntegerQ[m]] && Not[LtQ[m,0]]

2:  ∫((Tan[e+f x])^4) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ

Derivation: Algebraic expansion

Basis: ((Tan[z])^4)==1-((1-2 ((Sin[z])^2))/((Cos[z])^4))

Rule: If  (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ, then

∫((Tan[e+f x])^4) (((a+b Sin[e+f x]))^m)dx  ⟶  ∫(((a+b Sin[e+f x]))^m)dx-∫(((((a+b Sin[e+f x]))^m) (1-2 ((Sin[e+f x])^2)))/((Cos[e+f x])^4))dx

Program code:

Int[tan[e_.+f_.*x_]^4*(a_+b_.*sin[e_.+f_.*x_])^m_,x_Symbol] :=
  Int[(a+b*Sin[e+f*x])^m,x] - Int[(a+b*Sin[e+f*x])^m*(1-2*Sin[e+f*x]^2)/Cos[e+f*x]^4,x] /;
FreeQ[{a,b,e,f,m},x] && EqQ[a^2-b^2,0] && IntegerQ[m-1/2]

3.  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^2))dx  when (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ

1:  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^2))dx  when (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ ∧ m<-1

Rule: If  (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ ∧ m<-1, then

∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^2))dx  ⟶  -((((a+b Sin[e+f x]))^(m+1))/(a f Tan[e+f x]))+(1/(b^2)) ∫(((((a+b Sin[e+f x]))^(m+1)) (b m-a(m+1) Sin[e+f x]))/(Sin[e+f x]))dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_/tan[e_.+f_.*x_]^2,x_Symbol] :=
  -(a+b*Sin[e+f*x])^(m+1)/(a*f*Tan[e+f*x]) + 
  1/b^2*Int[(a+b*Sin[e+f*x])^(m+1)*(b*m-a*(m+1)*Sin[e+f*x])/Sin[e+f*x],x] /;
FreeQ[{a,b,e,f},x] && EqQ[a^2-b^2,0] && IntegerQ[m-1/2] && LtQ[m,-1]

2:  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^2))dx  when (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ ∧ m≮-1

Rule: If  (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ ∧ m≮-1, then

∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^2))dx  ⟶  -((((a+b Sin[e+f x]))^m)/(f Tan[e+f x]))+(1/a) ∫(((((a+b Sin[e+f x]))^m) (b m-a(m+1) Sin[e+f x]))/(Sin[e+f x]))dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_./tan[e_.+f_.*x_]^2,x_Symbol] :=
  -(a+b*Sin[e+f*x])^m/(f*Tan[e+f*x]) + 
  1/a*Int[(a+b*Sin[e+f*x])^m*(b*m-a*(m+1)*Sin[e+f*x])/Sin[e+f*x],x] /;
FreeQ[{a,b,e,f,m},x] && EqQ[a^2-b^2,0] && IntegerQ[m-1/2] && Not[LtQ[m,-1]]

4.  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  when (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ

1:  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  when (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ ∧ m<-1

Derivation: Algebraic expansion

Basis: If (a^2)-(b^2)==0, then (1/((Tan[z])^4))==-((2 (((a+b Sin[z]))^2))/(a b ((Sin[z])^3)))+(((((a+b Sin[z]))^2) (1+((Sin[z])^2)))/((a^2) ((Sin[z])^4)))

Rule: If  (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ ∧ m<-1, then

∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  ⟶  -(2/(a b))∫((((a+b Sin[e+f x]))^(m+2))/((Sin[e+f x])^3))dx+(1/(a^2))∫(((((a+b Sin[e+f x]))^(m+2)) (1+((Sin[e+f x])^2)))/((Sin[e+f x])^4))dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_/tan[e_.+f_.*x_]^4,x_Symbol] :=
  -2/(a*b)*Int[(a+b*Sin[e+f*x])^(m+2)/Sin[e+f*x]^3,x] + 
  1/a^2*Int[(a+b*Sin[e+f*x])^(m+2)*(1+Sin[e+f*x]^2)/Sin[e+f*x]^4,x] /;
FreeQ[{a,b,e,f},x] && EqQ[a^2-b^2,0] && IntegerQ[m-1/2] && LtQ[m,-1]

2:  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  when (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ ∧ m≮-1

Derivation: Algebraic expansion

Basis: (1/((Tan[z])^4))==1+((1-2 ((Sin[z])^2))/((Sin[z])^4))

Rule: If  (a^2)-(b^2)==0 ∧ m-(1/2)∈ℤ ∧ m≮-1, then

∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  ⟶  ∫(((a+b Sin[e+f x]))^m)dx+∫(((((a+b Sin[e+f x]))^m) (1-2 ((Sin[e+f x])^2)))/((Sin[e+f x])^4))dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_/tan[e_.+f_.*x_]^4,x_Symbol] :=
  Int[(a+b*Sin[e+f*x])^m,x] + Int[(a+b*Sin[e+f*x])^m*(1-2*Sin[e+f*x]^2)/Sin[e+f*x]^4,x] /;
FreeQ[{a,b,e,f,m},x] && EqQ[a^2-b^2,0] && IntegerQ[m-1/2] && Not[LtQ[m,-1]]

5:  ∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ m∉ℤ ∧ (p/2)∈ℤ

Derivation: Piecewise constant extraction and integration by substitution

Basis: If  (a^2)-(b^2)==0 ∧ (p/2)∈ℤ, then ((Tan[e+f x])^p)==((((b Sin[e+f x]))^p)/((((a-b Sin[e+f x]))^(p/2)) (((a+b Sin[e+f x]))^(p/2))))

Basis: If  (a^2)-(b^2)==0, then (∂_x)(((Sqrt[a+b Sin[e+f x]]) (Sqrt[a-b Sin[e+f x]]))/(Cos[e+f x]))==0

Basis: Cos[e+f x] F[b Sin[e+f x]]==(1/(b f)) Subst[F[x],x,b Sin[e+f x]] (∂_x)(b Sin[e+f x])

Rule: If  (a^2)-(b^2)==0 ∧ m∉ℤ ∧ (p/2)∈ℤ, then

∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  ⟶  ∫(((((b Sin[e+f x]))^p) (((a+b Sin[e+f x]))^(m-p/2)))/(((a-b Sin[e+f x]))^(p/2)))dx

  ⟶  (((Sqrt[a+b Sin[e+f x]]) (Sqrt[a-b Sin[e+f x]]))/(Cos[e+f x])) ∫((Cos[e+f x] (((b Sin[e+f x]))^p) (((a+b Sin[e+f x]))^(m-((p+1)/2))))/(((a-b Sin[e+f x]))^((p+1)/2)))dx

  ⟶  (((Sqrt[a+b Sin[e+f x]]) (Sqrt[a-b Sin[e+f x]]))/(b f Cos[e+f x])) Subst[∫(((x^p) (((a+x))^(m-((p+1)/2))))/(((a-x))^((p+1)/2)))dx,x,b Sin[e+f x]]

Program code:

Int[tan[e_.+f_.*x_]^p_*(a_+b_.*sin[e_.+f_.*x_])^m_,x_Symbol] :=
  Sqrt[a+b*Sin[e+f*x]]*Sqrt[a-b*Sin[e+f*x]]/(b*f*Cos[e+f*x])*
    Subst[Int[x^p*(a+x)^(m-(p+1)/2)/(a-x)^((p+1)/2),x],x,b*Sin[e+f*x]] /;
FreeQ[{a,b,e,f,m},x] && EqQ[a^2-b^2,0] && Not[IntegerQ[m]] && IntegerQ[p/2]

2:  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)==0 ∧ m∉ℤ ∧ p∉ℤ

Derivation: Piecewise constant extraction and integration by substitution

Basis: If  (a^2)-(b^2)==0, then (∂_x)(((((g Tan[e+f x]))^(p+1)) (((a-b Sin[e+f x]))^((p+1)/2)) (((a+b Sin[e+f x]))^((p+1)/2)))/(((b Sin[e+f x]))^(p+1)))==0

Basis: Cos[e+f x] F[b Sin[e+f x]]==(1/(b f)) Subst[F[x],x,b Sin[e+f x]] (∂_x)(b Sin[e+f x])

Rule: If (a^2)-(b^2)==0 ∧ m∉ℤ ∧ p∉ℤ, then

∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  ⟶  
  ⟶  ((b (((g Tan[e+f x]))^(p+1)) (((a-b Sin[e+f x]))^((p+1)/2)) (((a+b Sin[e+f x]))^((p+1)/2)))/(g (((b Sin[e+f x]))^(p+1)))) ∫((Cos[e+f x] (((b Sin[e+f x]))^p) (((a+b Sin[e+f x]))^(m-((p+1)/2))))/(((a-b Sin[e+f x]))^((p+1)/2)))dx

  ⟶  (((((g Tan[e+f x]))^(p+1)) (((a-b Sin[e+f x]))^((p+1)/2)) (((a+b Sin[e+f x]))^((p+1)/2)))/(f g (((b Sin[e+f x]))^(p+1)))) Subst[∫(((x^p) (((a+x))^(m-((p+1)/2))))/(((a-x))^((p+1)/2)))dx,x,b Sin[e+f x]]

Program code:

Int[(g_.*tan[e_.+f_.*x_])^p_*(a_+b_.*sin[e_.+f_.*x_])^m_,x_Symbol] :=
  (g*Tan[e+f*x])^(p+1)*(a-b*Sin[e+f*x])^((p+1)/2)*(a+b*Sin[e+f*x])^((p+1)/2)/(f*g*(b*Sin[e+f*x])^(p+1))*
    Subst[Int[x^p*(a+x)^(m-(p+1)/2)/(a-x)^((p+1)/2),x],x,b*Sin[e+f*x]] /;
FreeQ[{a,b,e,f,g,m,p},x] && EqQ[a^2-b^2,0] && Not[IntegerQ[m]] && Not[IntegerQ[p]]

2.  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)≠0

1:  ∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)≠0 ∧ ((p+1)/2)∈ℤ

Derivation: Integration by substitution

Basis: If ((p+1)/2)∈ℤ, then ((Tan[e+f x])^p)==((b Cos[e+f x] (((b Sin[e+f x]))^p))/((((b^2)-(b^2) ((Sin[e+f x])^2)))^((p+1)/2)))

Basis: Cos[e+f x] F[b Sin[e+f x]]==(1/(b f)) Subst[F[x],x,b Sin[e+f x]] (∂_x)(b Sin[e+f x])

Rule: If (a^2)-(b^2)≠0 ∧ ((p+1)/2)∈ℤ, then

∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  ⟶  b∫((Cos[e+f x] (((b Sin[e+f x]))^p) (((a+b Sin[e+f x]))^m))/((((b^2)-(b^2) ((Sin[e+f x])^2)))^((p+1)/2)))dx
  ⟶  (1/f) Subst[∫(((x^p) (((a+x))^m))/((((b^2)-(x^2)))^((p+1)/2)))dx,x,b Sin[e+f x]]

Program code:

Int[tan[e_.+f_.*x_]^p_.*(a_+b_.*sin[e_.+f_.*x_])^m_.,x_Symbol] :=
  1/f*Subst[Int[(x^p*(a+x)^m)/(b^2-x^2)^((p+1)/2),x],x,b*Sin[e+f*x]] /;
FreeQ[{a,b,e,f,m},x] && NeQ[a^2-b^2,0] && IntegerQ[(p+1)/2]

2:  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)≠0 ∧ m∈(SuperPlus[ℤ])

Derivation: Algebraic expansion

Rule: If  (a^2)-(b^2)≠0 ∧ m∈(SuperPlus[ℤ]), then

∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  ⟶  ∫(((g Tan[e+f x]))^p) ExpandIntegrand[(((a+b Sin[e+f x]))^m),x]dx

Program code:

Int[(g_.*tan[e_.+f_.*x_])^p_.*(a_+b_.*sin[e_.+f_.*x_])^m_.,x_Symbol] :=
  Int[ExpandIntegrand[(g*Tan[e+f*x])^p,(a+b*Sin[e+f*x])^m,x],x] /;
FreeQ[{a,b,e,f,g,p},x] && NeQ[a^2-b^2,0] && IGtQ[m,0]

3.  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)≠0 ∧ (p/2)∈ℤ

1:  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^2))dx  when (a^2)-(b^2)≠0

Derivation: Algebraic expansion

Basis: (1/((Tan[z])^2))==((1-((Sin[z])^2))/((Sin[z])^2))

Rule: If  (a^2)-(b^2)≠0, then

∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^2))dx  ⟶  ∫(((((a+b Sin[e+f x]))^m) (1-((Sin[e+f x])^2)))/((Sin[e+f x])^2))dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_/tan[e_.+f_.*x_]^2,x_Symbol] :=
  Int[(a+b*Sin[e+f*x])^m*(1-Sin[e+f*x]^2)/Sin[e+f*x]^2,x] /;
FreeQ[{a,b,e,f,m},x] && NeQ[a^2-b^2,0]

2.  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  when (a^2)-(b^2)≠0

1:  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  when (a^2)-(b^2)≠0 ∧ m<-1

Derivation: Algebraic expansion

Basis: (1/((Tan[z])^4))==1+((1-2 ((Sin[z])^2))/((Sin[z])^4))

Rule: If  (a^2)-(b^2)≠0 ∧ m<-1, then

∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  ⟶  ∫(((a+b Sin[e+f x]))^m)dx+∫(((((a+b Sin[e+f x]))^m) (1-2 ((Sin[e+f x])^2)))/((Sin[e+f x])^4))dx  ⟶  

-((Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/(3 a f ((Sin[e+f x])^3)))-(((3 (a^2)+(b^2) (m-2)) Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/(3 (a^2) b f (m+1) ((Sin[e+f x])^2)))-
(1/(3 (a^2)b (m+1)))∫(((((a+b Sin[e+f x]))^(m+1)) (6 (a^2)-(b^2) (m-1) (m-2)+a b (m+1) Sin[e+f x]-(3 (a^2)-(b^2) m (m-2)) ((Sin[e+f x])^2)))/((Sin[e+f x])^3))dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_/tan[e_.+f_.*x_]^4,x_Symbol] :=
  -Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(3*a*f*Sin[e+f*x]^3) - 
  (3*a^2+b^2*(m-2))*Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(3*a^2*b*f*(m+1)*Sin[e+f*x]^2) - 
  1/(3*a^2*b*(m+1))*Int[(a+b*Sin[e+f*x])^(m+1)/Sin[e+f*x]^3*
    Simp[6*a^2-b^2*(m-1)*(m-2)+a*b*(m+1)*Sin[e+f*x]-(3*a^2-b^2*m*(m-2))*Sin[e+f*x]^2,x],x] /;
FreeQ[{a,b,e,f},x] && NeQ[a^2-b^2,0] && LtQ[m,-1] && IntegerQ[2*m]

x:  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  when (a^2)-(b^2)≠0 ∧ m≮-1

Derivation: Algebraic expansion

Basis: (1/((Tan[z])^4))==1+((1-2 ((Sin[z])^2))/((Sin[z])^4))

Rule: If  (a^2)-(b^2)≠0 ∧ m≮-1, then

∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  ⟶  ∫(((a+b Sin[e+f x]))^m)dx+∫(((((a+b Sin[e+f x]))^m) (1-2 ((Sin[e+f x])^2)))/((Sin[e+f x])^4))dx  ⟶  

-((Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/(3 a f ((Sin[e+f x])^3)))-((Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/(b f m ((Sin[e+f x])^2)))-
(1/(3 a b m))∫(((((a+b Sin[e+f x]))^m) (6 (a^2)-(b^2) m (m-2)+a b (m+3) Sin[e+f x]-(3 (a^2)-(b^2) m (m-1)) ((Sin[e+f x])^2)))/((Sin[e+f x])^3))dx

Program code:

(* Int[(a_+b_.*sin[e_.+f_.*x_])^m_/tan[e_.+f_.*x_]^4,x_Symbol] :=
  -Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(3*a*f*Sin[e+f*x]^3) - 
  Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(b*f*m*Sin[e+f*x]^2) - 
  1/(3*a*b*m)*Int[(a+b*Sin[e+f*x])^m/Sin[e+f*x]^3*
    Simp[6*a^2-b^2*m*(m-2)+a*b*(m+3)*Sin[e+f*x]-(3*a^2-b^2*m*(m-1))*Sin[e+f*x]^2,x],x] /;
FreeQ[{a,b,e,f,m},x] && NeQ[a^2-b^2,0] && Not[LtQ[m,-1]] && IntegerQ[2*m] *)

2:  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  when (a^2)-(b^2)≠0 ∧ m≮-1

Basis: (1/((Tan[z])^4))==(1/((Sin[z])^4))-((2-((Sin[z])^2))/((Sin[z])^2))

Rule: If  (a^2)-(b^2)≠0 ∧ m≮-1, then

∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^4))dx  ⟶  ∫((((a+b Sin[e+f x]))^m)/((Sin[e+f x])^4))dx-∫(((((a+b Sin[e+f x]))^m) (2-((Sin[e+f x])^2)))/((Sin[e+f x])^2))dx  ⟶  

-((Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/(3 a f ((Sin[e+f x])^3)))-((b (m-2) Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/(6 (a^2) f ((Sin[e+f x])^2)))-
(1/(6 (a^2)))∫(((((a+b Sin[e+f x]))^m) (8 (a^2)-(b^2) (m-1) (m-2)+a b m Sin[e+f x]-(6 (a^2)-(b^2) m (m-2)) ((Sin[e+f x])^2)))/((Sin[e+f x])^2))dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_/tan[e_.+f_.*x_]^4,x_Symbol] :=
  -Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(3*a*f*Sin[e+f*x]^3) - 
  b*(m-2)*Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(6*a^2*f*Sin[e+f*x]^2) - 
  1/(6*a^2)*Int[(a+b*Sin[e+f*x])^m/Sin[e+f*x]^2*
    Simp[8*a^2-b^2*(m-1)*(m-2)+a*b*m*Sin[e+f*x]-(6*a^2-b^2*m*(m-2))*Sin[e+f*x]^2,x],x] /;
FreeQ[{a,b,e,f,m},x] && NeQ[a^2-b^2,0] && Not[LtQ[m,-1]] && IntegerQ[2*m]

3:  ∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^6))dx  when (a^2)-(b^2)≠0 ∧ m≠1

Basis: (1/((Tan[z])^6))==((1-3 ((Sin[z])^2))/((Sin[z])^6))+((3-((Sin[z])^2))/((Sin[z])^2))

Rule: If  (a^2)-(b^2)≠0 ∧ m≠1, then

∫((((a+b Sin[e+f x]))^m)/((Tan[e+f x])^6))dx  ⟶  ∫(((((a+b Sin[e+f x]))^m) (1-3 ((Sin[e+f x])^2)))/((Sin[e+f x])^6))dx+∫(((((a+b Sin[e+f x]))^m) (3-((Sin[e+f x])^2)))/((Sin[e+f x])^2))dx  ⟶  

-((Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/(5 a f ((Sin[e+f x])^5)))-((b (m-4) Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/(20 (a^2) f ((Sin[e+f x])^4)))+
((a Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/((b^2) f m (m-1) ((Sin[e+f x])^3)))+((Cos[e+f x] (((a+b Sin[e+f x]))^(m+1)))/(b f m ((Sin[e+f x])^2)))+(1/(20 (a^2) (b^2) m (m-1)))∫((((a+b Sin[e+f x]))^m)/((Sin[e+f x])^4))·
(60 (a^4)-44 (a^2) (b^2) (m-1) m+(b^4) m (m-1) (m-3) (m-4)+a b m (20 (a^2)-(b^2) m (m-1)) Sin[e+f x]-(40 (a^4)+(b^4) m (m-1) (m-2) (m-4)-20 (a^2) (b^2) (m-1) (2 m+1)) ((Sin[e+f x])^2))dx

Program code:

Int[(a_+b_.*sin[e_.+f_.*x_])^m_/tan[e_.+f_.*x_]^6,x_Symbol] :=
  -Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(5*a*f*Sin[e+f*x]^5) - 
  b*(m-4)*Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(20*a^2*f*Sin[e+f*x]^4) + 
  a*Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(b^2*f*m*(m-1)*Sin[e+f*x]^3) + 
  Cos[e+f*x]*(a+b*Sin[e+f*x])^(m+1)/(b*f*m*Sin[e+f*x]^2) + 
  1/(20*a^2*b^2*m*(m-1))*Int[(a+b*Sin[e+f*x])^m/Sin[e+f*x]^4*
    Simp[60*a^4-44*a^2*b^2*(m-1)*m+b^4*m*(m-1)*(m-3)*(m-4)+a*b*m*(20*a^2-b^2*m*(m-1))*Sin[e+f*x]-
      (40*a^4+b^4*m*(m-1)*(m-2)*(m-4)-20*a^2*b^2*(m-1)*(2*m+1))*Sin[e+f*x]^2,x],x] /;
FreeQ[{a,b,e,f,m},x] && NeQ[a^2-b^2,0] && NeQ[m,1] && IntegerQ[2*m]

4.  ∫((((g Tan[e+f x]))^p)/(a+b Sin[e+f x]))dx  when (a^2)-(b^2)≠0 ∧ 2 p∈ℤ

1:  ∫((((g Tan[e+f x]))^p)/(a+b Sin[e+f x]))dx  when (a^2)-(b^2)≠0 ∧ 2 p∈ℤ ∧ p>1

Derivation: Algebraic expansion

Basis: (((Tan[z])^2)/(a+b Sin[z]))==((a ((Tan[z])^2))/(((a^2)-(b^2)) ((Sin[z])^2)))-((b Tan[z])/(((a^2)-(b^2)) Cos[z]))-((a^2)/(((a^2)-(b^2)) (a+b Sin[z])))

Rule: If  (a^2)-(b^2)≠0 ∧ 2 p∈ℤ ∧ p>1, then

∫((((g Tan[e+f x]))^p)/(a+b Sin[e+f x]))dx  ⟶  (a/((a^2)-(b^2)))∫((((g Tan[e+f x]))^p)/((Sin[e+f x])^2))dx-((b g)/((a^2)-(b^2)))∫((((g Tan[e+f x]))^(p-1))/(Cos[e+f x]))dx-(((a^2) (g^2))/((a^2)-(b^2)))∫((((g Tan[e+f x]))^(p-2))/(a+b Sin[e+f x]))dx

Program code:

Int[(g_.*tan[e_.+f_.*x_])^p_/(a_+b_.*sin[e_.+f_.*x_]),x_Symbol] :=
  a/(a^2-b^2)*Int[(g*Tan[e+f*x])^p/Sin[e+f*x]^2,x] - 
  b*g/(a^2-b^2)*Int[(g*Tan[e+f*x])^(p-1)/Cos[e+f*x],x] - 
  a^2*g^2/(a^2-b^2)*Int[(g*Tan[e+f*x])^(p-2)/(a+b*Sin[e+f*x]),x] /;
FreeQ[{a,b,e,f,g},x] && NeQ[a^2-b^2,0] && IntegersQ[2*p] && GtQ[p,1]

2:  ∫((((g Tan[e+f x]))^p)/(a+b Sin[e+f x]))dx  when (a^2)-(b^2)≠0 ∧ 2 p∈ℤ ∧ p<-1

Derivation: Algebraic expansion

Basis: (1/(a+b Sin[z]))==(1/(a ((Cos[z])^2)))-((b Tan[z])/((a^2) Cos[z]))-((((a^2)-(b^2)) ((Tan[z])^2))/((a^2) (a+b Sin[z])))

Rule: If  (a^2)-(b^2)≠0 ∧ 2 p∈ℤ ∧ p<-1, then

∫((((g Tan[e+f x]))^p)/(a+b Sin[e+f x]))dx  ⟶  (1/a)∫((((g Tan[e+f x]))^p)/((Cos[e+f x])^2))dx-(b/((a^2) g))∫((((g Tan[e+f x]))^(p+1))/(Cos[e+f x]))dx-(((a^2)-(b^2))/((a^2) (g^2)))∫((((g Tan[e+f x]))^(p+2))/(a+b Sin[e+f x]))dx

Program code:

Int[(g_.*tan[e_.+f_.*x_])^p_/(a_+b_.*sin[e_.+f_.*x_]),x_Symbol] :=
  1/a*Int[(g*Tan[e+f*x])^p/Cos[e+f*x]^2,x] - 
  b/(a^2*g)*Int[(g*Tan[e+f*x])^(p+1)/Cos[e+f*x],x] - 
  (a^2-b^2)/(a^2*g^2)*Int[(g*Tan[e+f*x])^(p+2)/(a+b*Sin[e+f*x]),x] /;
FreeQ[{a,b,e,f,g},x] && NeQ[a^2-b^2,0] && IntegersQ[2*p] && LtQ[p,-1]

3:  ∫((Sqrt[g Tan[e+f x]])/(a+b Sin[e+f x]))dx  when (a^2)-(b^2)≠0

Derivation: Piecewise constant extraction

Basis: (∂_x)(((Sqrt[Cos[e+f x]]) (Sqrt[g Tan[e+f x]]))/(Sqrt[Sin[e+f x]]))==0

Rule: If  (a^2)-(b^2)≠0, then

∫((Sqrt[g Tan[e+f x]])/(a+b Sin[e+f x]))dx  ⟶  (((Sqrt[Cos[e+f x]]) (Sqrt[g Tan[e+f x]]))/(Sqrt[Sin[e+f x]]))∫((Sqrt[Sin[e+f x]])/((Sqrt[Cos[e+f x]]) (a+b Sin[e+f x])))dx

Program code:

Int[Sqrt[g_.*tan[e_.+f_.*x_]]/(a_+b_.*sin[e_.+f_.*x_]),x_Symbol] :=
  Sqrt[Cos[e+f*x]]*Sqrt[g*Tan[e+f*x]]/Sqrt[Sin[e+f*x]]*Int[Sqrt[Sin[e+f*x]]/(Sqrt[Cos[e+f*x]]*(a+b*Sin[e+f*x])),x] /;
FreeQ[{a,b,e,f,g},x] && NeQ[a^2-b^2,0]

4:  ∫(1/((Sqrt[g Tan[e+f x]]) (a+b Sin[e+f x])))dx  when (a^2)-(b^2)≠0

Derivation: Piecewise constant extraction

Basis: (∂_x)((Sqrt[Sin[e+f x]])/((Sqrt[Cos[e+f x]]) (Sqrt[g Tan[e+f x]])))==0

Rule: If  (a^2)-(b^2)≠0, then

∫(1/((Sqrt[g Tan[e+f x]]) (a+b Sin[e+f x])))dx  ⟶  ((Sqrt[Sin[e+f x]])/((Sqrt[Cos[e+f x]]) (Sqrt[g Tan[e+f x]])))∫((Sqrt[Cos[e+f x]])/((Sqrt[Sin[e+f x]]) (a+b Sin[e+f x])))dx

Program code:

Int[1/(Sqrt[g_*tan[e_.+f_.*x_]]*(a_+b_.*sin[e_.+f_.*x_])),x_Symbol] :=
  Sqrt[Sin[e+f*x]]/(Sqrt[Cos[e+f*x]]*Sqrt[g*Tan[e+f*x]])*Int[Sqrt[Cos[e+f*x]]/(Sqrt[Sin[e+f*x]]*(a+b*Sin[e+f*x])),x] /;
FreeQ[{a,b,e,f,g},x] && NeQ[a^2-b^2,0]

5:  ∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  when (a^2)-(b^2)≠0 ∧ (m|(p/2))∈ℤ

Derivation: Algebraic expansion

Basis: If (p/2)∈ℤ, then ((Tan[e+f x])^p)==(((Sin[e+f x])^p)/(((1-((Sin[e+f x])^2)))^(p/2)))

Rule: If  (a^2)-(b^2)≠0 ∧ (m|(p/2))∈ℤ, then

∫((Tan[e+f x])^p) (((a+b Sin[e+f x]))^m)dx  ⟶  ∫ExpandIntegrand[((((Sin[e+f x])^p) (((a+b Sin[e+f x]))^m))/(((1-((Sin[e+f x])^2)))^(p/2))),x]dx

Program code:

Int[tan[e_.+f_.*x_]^p_*(a_+b_.*sin[e_.+f_.*x_])^m_,x_Symbol] :=
  Int[ExpandIntegrand[Sin[e+f*x]^p*(a+b*Sin[e+f*x])^m/(1-Sin[e+f*x]^2)^(p/2),x],x] /;
FreeQ[{a,b,e,f},x] && NeQ[a^2-b^2,0] && IntegersQ[m,p/2]

X:  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx

Rule:

∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  ⟶  ∫(((g Tan[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx

Program code:

Int[(g_.*tan[e_.+f_.*x_])^p_.*(a_+b_.*sin[e_.+f_.*x_])^m_.,x_Symbol] :=
  Unintegrable[(g*Tan[e+f*x])^p*(a+b*Sin[e+f*x])^m,x] /;
FreeQ[{a,b,e,f,g,m,p},x]

Rules for integrands of the form (((g Cot[e+f x]))^p) (((a+b Sin[e+f x]))^m)

1:  ∫(((g Cot[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  when p∉ℤ

Derivation: Piecewise constant extraction

Basis: (∂_x)((((g Cot[e+f x]))^p) (((g Tan[e+f x]))^p))==0

Rule: If  p∉ℤ, then

∫(((g Cot[e+f x]))^p) (((a+b Sin[e+f x]))^m)dx  ⟶  (g^(2 IntPart[p])) (((g Cot[e+f x]))^(FracPart[p])) (((g Tan[e+f x]))^(FracPart[p]))∫((((a+b Sin[e+f x]))^m)/(((g Tan[e+f x]))^p))dx

Program code:

Int[(g_.*cot[e_.+f_.*x_])^p_*(a_+b_.*sin[e_.+f_.*x_])^m_.,x_Symbol] :=
  g^(2*IntPart[p])*(g*Cot[e+f*x])^FracPart[p]*(g*Tan[e+f*x])^FracPart[p]*Int[(a+b*Sin[e+f*x])^m/(g*Tan[e+f*x])^p,x] /;
FreeQ[{a,b,e,f,g,m,p},x] && Not[IntegerQ[p]]